package com.dooioo.fangyou.web.validation;

import com.dooioo.fangyou.entity.Pet;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;

/**
 * Created by IntelliJ IDEA.
 * User: kuang
 * Date: 2010-12-5
 * Time: 15:07:34
 * To change this template use File | Settings | File Templates.
 */
public class PetValidator {
    public void validate(Pet pet, Errors errors) {
        String name = pet.getName();
        if (!StringUtils.hasLength(name)) {
            errors.rejectValue("name", "required", "required");
        }
    }
}
